package com.newcoder.leetcode;

import java.util.Arrays;

public class String_isValid {

    public static void main(String[] args) {
        String s = "{[()]}";
        boolean result = new String_isValid().isValid(s);
        System.out.println(result);
    }

    public boolean isValid(String s) {
        int index = s.length()/2;
        while (index>0) {
            s = s.replace("{}","").replace("[]","").replace("()","");
            index--;
        }
        return s.length()==0;
    }
}
